package com.qingke.dao;


import java.util.List;
import org.apache.ibatis.session.SqlSession;

public class WordDao {

	public String getWord(SqlSession session,String en ){
		//SqlSession  session = SessionManager.getInstance().getSession();
		WordMapper mapper  = session.getMapper(WordMapper.class);
		return  mapper.getWord(en);
	}
	void insertWord(SqlSession  session,String en ,String cn){
		//SqlSession  session = SessionManager.getInstance().getSession();
		WordMapper mapper  = session.getMapper(WordMapper.class);
		if(getWord(session, en) == null){
			mapper.insertWord(en, cn);
		}
	}
	public List<String> searchWord(String en){
		SqlSession  session = SessionManager.getInstance().getSession();
		WordMapper mapper  = session.getMapper(WordMapper.class);
		return mapper.serach(en);
	}
}
